package cn.com.infcn.spider.domain;

import com.mongodb.DBObject;

import cn.com.infcn.spider.util.ObjConver;

/**
 * 网址队列信息
 * 
 * @author ansj
 *
 */
public abstract class UriInfo {

	protected String uri;

	private int errCount = 0;

	public UriInfo() {
	}

	public UriInfo(DBObject obj) {
		this.uri = (String) obj.get("_id");
		this.errCount = ObjConver.castToInt(obj.get("errCount")) + 1;
	}

	public UriInfo(String url) {
		this.uri = url;
	}


	public String getUri() {
		return uri;
	}

	public void setUri(String url) {
		this.uri = url;
	}

	public int getErrCount() {
		return errCount;
	}

	public void setErrCount(int errCount) {
		this.errCount = errCount;
	}

	@Override
	public int hashCode() {
		return uri.hashCode();
	}

	@Override
	public boolean equals(Object obj) {
		return uri.equals(obj);
	}

	
}
